package com.example.kumrulutest;

import java.util.concurrent.ExecutionException;

import android.content.SharedPreferences;

import com.google.gson.Gson;

public class Global {
	
	public Formula getOnlineData()
	{
		Formula formula = new Formula();
		try {
			WebServiceConnector rf = new WebServiceConnector();
			String result = rf.execute().get();
			Gson gson = new Gson();
			formula = gson.fromJson(result, Formula.class);
		} catch (InterruptedException e) {
			e.printStackTrace();
		} catch (ExecutionException e) { 
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally
		{
			return formula;
		}
	}
	
	public class Formula
    {
		//fill variables with 2013 values in case a web service connection error occurs 
        public double StampTaxPercentage = 0;
        public double SGKLowerLimitFirstHalf = 0;
        public double SGKLowerLimitSecondHalf = 0;
        public double FirstLimitTotalTaxAssessment = 0;
        public double SecondLimitTotalTaxAssessment = 0;
        public double ThirdLimitTotalTaxAssessment = 0;
        public double DisabilityAllowance1 = 0;
        public double DisabilityAllowance2 = 0;
        public double DisabilityAllowance3 = 0;
        public double MinimumWageFirstHalf = 0;
        public double MinimumWageSecondHalf = 0;
        public double SubsistenceConstant1 = 0;
        public double SubsistenceConstant2 = 0;
        public double SubsistenceConstant3 = 0;
        public double SubsistenceConstant4 = 0;
        public double SubsistenceConstant5 = 0;
        public double SubsistenceConstant6 = 0;
        public double SubsistenceConstant7 = 0;
        public double SubsistenceConstant8 = 0;
        public double SubsistenceConstant9 = 0;
        public double SubsistenceConstant10 = 0;
        public double SubsistenceConstant11 = 0;
    }

}
